import React from "react"
import { Navigate } from "react-router-dom"
import { withAuth } from "./common"
import Login from "@/views/login/Index"
import Home from "@/views/home/Index"
import PageNotFound from "@/views/pageNotFound/Index"
import frontPage from "./routes/frontPage"
import optionT from "./routes/optionT"
import userL from "./routes/userL"

const LoginWithAuth = withAuth(Login)
const HomeWithAuth = withAuth(Home)
const routes = [
  {
    path: "/login",
    element: <LoginWithAuth />
  },
  {
    path: "/",
    element: <Navigate to="/test001" />
  },
  {
    path: "/",
    element: <HomeWithAuth />,
    children: [...frontPage, ...optionT, ...userL]
  },
  {
    path: "*",
    element: <PageNotFound />
  }
]
export default routes
